import ScrollBarLayout from '@/components/ScrollBarLayout';
import Cls from 'classnames';
import { useContext, useEffect, useMemo, useState } from 'react';
import pageStyles from '@/common/pageLayout.less';
// import { ConditionManageContext } from '../mconfig/useManageContext';
import { DescriptionsType } from '@/components/DescriptionsType';
import { changeNumMoneyToChinese, wordHandChildParam, wordToChildParams } from '@/utils';
import { getUpdateConfig } from '../mconfig/UpdateConfig';
import { connect } from 'umi';
import { Col, Form, Row, Spin, message, Tabs } from 'antd';
import { getCurrentRouteObj } from '@/utils';
// import { ConditionManageAPI } from '../common/type';

const UpdataMaterialModal: React.FC<any> = ({ curRes, locationProps }) => {
  /** 引入上下文 */
  // const {

  // } = useContext(ConditionManageContext);
  /** 样式根目录 */
  const styleFixCls = 'contract-styfixcls-';

  /** 获取表单配置
   *  @leftSelectName    左侧仓库名称
   *  @record   当前项
   */
  let storageRouterObj: string | any = getCurrentRouteObj(); //获取解密后的当前页面路由数据
  const { config, methods } = getUpdateConfig({ pageType: locationProps.state.pageType });

  /** 返回tab子页面 */
  const tabsItem = useMemo(() => {
    let items: any[] = [
      {
        label: '基本信息',
        key: '001',
        children: (
          <div className="commonTabsBodyDom">
            <div className={Cls('tabsBodyInfoDom', `${styleFixCls}updateFormBox`)}>
              <ScrollBarLayout style={{ padding: '5px 20px' }}>
                <DescriptionsType config={config} />
              </ScrollBarLayout>
            </div>
          </div>
        ),
      },
    ];
    return items;
  }, []);

  // useEffect(()=>{
  //   console.log('123',storageRouterObj)
  // },[])

  return (
    <>
      <Spin spinning={false}>
        <Row gutter={[8, 8]} className={`${styleFixCls}row`}>
          <Col span={24} className={`${styleFixCls}row-col`}>
            <Tabs className={pageStyles['commonTabs']} type="card" onChange={(activeKey: string) => {}} items={tabsItem} destroyInactiveTabPane={true} />
          </Col>
        </Row>
      </Spin>
    </>
  );
};

export default connect(({ baseLogin, navTab }: Record<string, any>) => ({
  curRes: baseLogin?.permissions,
  navTab,
}))(UpdataMaterialModal);
